<?php
	if(!defined("IN_APP"))
	{
		exit;
	}
	
	if(!adminpermission('S','110000'))
	{
		echo '无权查看!';
		exit;
	}
	
	$sqlTools = new _SqlTool();
	
	$parm = requestArrayParm($_REQUEST);
	
	if($parm['m'] == 'list')
	{
		unset($wheres,$ptlist);
		$wheres['status'] = '2';
		$sorts['addtime'] = 'desc';
		$resData = $sqlTools->getList('pingtai',$wheres,$pages,$sorts);
		foreach ($resData as $k => $v)
		{
			$ptlist[] = $v;
		}
		
		unset($wheres,$pages,$sorts,$list);
		$wheres['status'] = '2';
		$wheres['status2'] = '1';
		$wheres['cp_fllx'] = '2';
		if($parm['phone'])
		{
			$wheres['phone'] = $parm['phone'];
		}
		
		if($parm['name'])
		{
			$wheres['name'] = $parm['name'];
		}
		
		if($parm['pt_id'])
		{
			$wheres['pt_id'] = $parm['pt_id'];
		}
		
		if($parm['start'] && $parm['end'])
		{
			$wheres['tztime'] = array('>=',strtotime($parm['start']));
			
			$wheres['tztime'] = array('<=',strtotime($parm['end'])+86399);
		}
		
		$pages['rows'] = 20;
		$pages['page'] = getParam('page','get',1);
		$sorts['tztime'] = 'desc';
		$resData = $sqlTools::getList('tzinfo', $wheres, $pages, $sorts, $between);
		
		foreach ($resData['list'] as $key => $v)
		{
			unset($info,$query);
			$query['id'] = $v['pt_id'];
			$pingtai = _SqlTool::getInfo('pingtai', $query);
			$v['pt_name'] = $pingtai['pt_name'];
			unset($info,$query);
			$query['id'] = $v['cp_id'];
			$chanpin = _SqlTool::getInfo('chanpin', $query);
			$v['cp_name'] = $chanpin['cp_mc'];
			$list[] = $v;
		}
		
		$pageurl = SITE_URL.'index.php?'.set_URL_Param(get_URL_Param());
	
		$pagetotal = $resData["pages"];
		
		include renderTemplate('shenhe/fllist');
	}